package com.cms.admin.service.order.impl;

import com.cms.admin.mapper.RegisterOrderMapper;
import com.cms.admin.model.PageBean;
import com.cms.admin.model.RegisterOrder;
import com.cms.admin.model.RegisterOrderExt;
import com.cms.admin.model.RegisterOrderReport;
import com.cms.admin.service.order.RegisterOrderService;

import java.util.List;


public class RegisterOrderServiceImpl implements RegisterOrderService{

    private RegisterOrderMapper registerOrderMapper;

	@Override
	public List<RegisterOrder> queryOrderList(PageBean page, RegisterOrderExt example) {
		int count=getRowCount(example);
		page.setAllRow(count);
		example.setOffset(page.getOffset());
		example.setPageSize(page.getPageSize());
		return registerOrderMapper.selectByConditionWithLimit(example);
	}

    @Override
    public int getRowCount(RegisterOrderExt example) {
        return registerOrderMapper.countByCondition(example);
    }

    public RegisterOrderMapper getRegisterOrderMapper() {
        return registerOrderMapper;
    }

    public void setRegisterOrderMapper(RegisterOrderMapper registerOrderMapper) {
        this.registerOrderMapper = registerOrderMapper;
    }

	@Override
	public List<RegisterOrderReport> selectOrderForReport(RegisterOrderExt example) {
		// TODO Auto-generated method stub
		return registerOrderMapper.selectOrderForReport(example);
	}

	@Override
	public List<RegisterOrderReport> selectOrderForReportWithStuff(PageBean page,
			RegisterOrderExt example) {
		// TODO Auto-generated method stub
		int count=registerOrderMapper.selectOrderForReportWithStuffCount(example);
		page.setAllRow(count);
		example.setOffset(page.getOffset());
		example.setPageSize(page.getPageSize());
		return registerOrderMapper.selectOrderForReportWithStuff(example);
	}

	
	@Override
	public List<RegisterOrderReport> selectOrderForReportWithTypeId(
			RegisterOrderExt example) {
		// TODO Auto-generated method stub
		return registerOrderMapper.selectOrderForReportWithTypeId(example);
	}

	@Override
	public List<RegisterOrderReport> selectOrderForReportWithChannel(
			RegisterOrderExt example) {
		// TODO Auto-generated method stub
		return registerOrderMapper.selectOrderForReportWithChannel(example);
	}

	@Override
	public RegisterOrderExt queryOrderDetail(Long registerid) {
		return registerOrderMapper.selectDetailByOrderId(registerid);
	}

	@Override
	public RegisterOrderExt queryOrderDetailWithUrl(Long registerid) {
		return registerOrderMapper.selectDetailWithUrlByOrderId(registerid);
	}

	@Override
	public List<RegisterOrderReport> selectOrderForReportWithStuffDailyChannel(
			RegisterOrderExt example) {
		// TODO Auto-generated method stub
		return registerOrderMapper.selectOrderForReportWithStuffDailyChannel(example);
	}

	@Override
	public List<RegisterOrderReport> selectOrderForReportWithStuffDailyTypeId(
			RegisterOrderExt example) {
		// TODO Auto-generated method stub
		return registerOrderMapper.selectOrderForReportWithStuffDailyTypeId(example);
	}

	@Override
	public List<RegisterOrderReport> selectOrderForReportWithStuffAll(
			RegisterOrderExt example) {
		// TODO Auto-generated method stub
		return registerOrderMapper.selectOrderForReportWithStuffAll(example);
	}
}
